In a conventional compression-encoding system that compresses and encodes picture data, picture data is quantized in the unit of one block composed of a predetermined number of pixels. For example, in the MPEG2 (Moving Pictures Experts Group 2), such a compression-encoding system is used. In the MPEG2, picture data is transformed in the DCT (Discrete Cosine Transform) method in the unit of one block composed of a predetermined number of pixels. The obtained DCT coefficients are quantized. As a result, the picture data is compression-encoded. In the MPEG2, with a quantizer step designated with a quantizer scale, DCT coefficients are compressed and encoded.
Conventionally, in the MPEG2 compression-encoding, a method for calculating an index referred to as activity that represents complexity or smoothness of a picture to be compressed and optimizing the picture quality using adaptive quantization corresponding to the activity is known.
This method is performed as follows. When the compressing process is performed for a simple and smooth picture region, the deterioration of the picture quality is obstructive. In this region (referred to as flat region), the picture data is finely quantized with a quantizer scale whose quantizer step is small. In contrast, when the compressing process is performed for a complex picture region, the deterioration of the picture quality is not obstructive. In this region, the picture data is coarsely quantized with a quantizer scale whose quantizer step is large. Thus, with a limited code amount, the picture quality can be effectively optimized.
When picture data is compressed, as was described above, each picture region is divided into pixel blocks each having a predetermined size. The picture data is quantized and transformed using the DCT method in the unit of one pixel block. The MPEG2 standard prescribes a block of eight pixels×eight lines as the minimum process unit. In addition, the MPEG2 standard prescribes that each block of eight pixels×eight lines should be transformed using the DCT method and that the resultant DCT coefficients should be quantized in the unit of one macro block of 16 pixels×16 lines.
On the other hand, although the MPEG2 standard does not clearly prescribe a unit for calculating the forgoing activity, however, the MPEG2 TM5 (Test Model 5) has proposed that the activity should be processed in the unit of one sub block of eight pixels×eight lines, which is the same as one DCT block.
Next, the activity calculating method in “adaptive quantization considering visual characteristic” that has been used in the MPEG2 TM5 will be described.
The adaptive quantization is to vary a quantizer scale Qj corresponding to the state of a picture with an activity of each macro block so as to control a generated code amount of for example one frame and improve the picture quality. The quantizer scale Qj is varied with an activity so that in a flat region, where the deterioration of the picture quality is obstructive, the picture data is quantized with a quantizer scale Qj whose quantizer step is small and in a complex picture region, where the deterioration of the picture quality is not obstructive, the picture data is quantized with a quantizer scale Qj whose quantizer step is large.
An activity is calculated with pixel values of a luminance signal of an original picture rather than a predictive error. In other words, an activity is calculated with pixel values of a total of eight blocks that are four blocks in the frame DCT encoding mode and our blocks in the field DCT encoding mode. For example, an activity actj of a j-th macro block is obtained by calculating the following Formulas (1) to (3) in the reverse order (namely, in the order of Formula (3), Formula (2), and Formula (1)).actj=1+min[sblk=1, 8](var_sblk)  (1)var_sblk=1/64 Σ[k=1, 64](Pk−Pavg)2  (2)Pavg=1/64 Σ[k=1, 64]Pk  (3)
where Pk is a pixel value of a block of a luminance signal of the original picture. In Formula (3), 64 pixel values of a block of 8×8 are summed and the result is divided by 64. As a result, an average value Pavg of pixel values Pk of the block is obtained. Next, in Formula (2), the difference between the average value Pavg and each pixel value Pk is obtained. As a result, average difference values var_sblk of the block of 8×8 are calculated. In Formula (1), with the minimum value of the average difference values var_sblk, an activity actj of the j-th macro block is obtained. The minimum value is used because even if a part of the macro block contains a flat portion, it is necessary to finely quantize the macro block.
In the MPEG2 TM5, a normalized activity Nactj that has values in the range from “2.0” to “0.5” is obtained from activities actj of macro blocks corresponding to the following Formula (4).Nactj=(2×actj+avg_act)/(actj+2×avg_act)  (4)
where “avg_act” represents an average value (average activity) of activities actj of an encoded frame immediately preceded by a frame (picture) that is currently being processed.
A quantizer scale mquantj that considers a visual characteristic is given by the following Formula (5) corresponding to a quantizer scale Qj that is obtained for controlling a generated code amount of one frame.mquantj=Qj×Nactj  (5)
When each macro block is quantized with such a quantizer scale mquantj, while the code amount of one whole frame is kept in a predetermined range, each macro block is optimally quantized corresponding to flatness and complexity of a picture of the frame. As a result, while a limited code amount is effectively used, the picture is effectively compressed with much suppression of the picture quality.
When normalization is performed according to the MPEG2 TM5, a normalized activity Nactj is obtained by the forgoing Formula (4). In other words, whatever pattern a frame has, the normalization ranges from “0.5” to “2.0”. Thus, in a frame having for example a flat pattern, quantized values of individual macro blocks largely vary.
On the other hand, in a frame having a complex pattern, a macro block of a complex portion uses a lat of a code amount. Thus, a macro block of a relatively flat pattern portion uses a limited code amount. As a result, the picture quality of a macro block having a flat pattern whose deterioration tends to be obstructive deteriorates.
The deterioration of the picture quality becomes remarkable especially when the compression rate is low and the code amount is relatively affordable.
Therefore, an object of the present invention is to provide a picture processing apparatus, a picture processing method, a picture processing program, and a recording medium for normalizing an activity corresponding to a characteristic of a pattern of a frame and optimizing the picture quality using adaptive quantization.